/*
 * (C) Copyright 2012, by Tim Xie.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.superapk.diamond.http;

/**
 * 请求服务器回调接口
 * 
 * @author     Tim Xie [tim.xie2008@gmail.com]
 * @date       2013-2-21
 * 
 */

public interface HttpHandlerCallback {
	
	/**
	 * 当接收到服务器返回的数据后调用，该方法运行在UI线程中
	 * 
	 * @param data 回调的数据
	 */
	public void serverResponse(byte[] data);
	
	/**
	 * 返回请求的Code，如果是200等待serverResponse函数返回数据，如果不是200，UI立刻切换到非联网状态
	 * 该方法会多次响应，可能先得到200，然后联网异常断开返回错误码
	 * 如果需要提示语，根据ResponseStatus返回提示语
	 * @param httpCode 
	 */
	public void serverResponseError(int httpCode);
	
	/**
	 * 返回网络完成的百分比
	 * @param percentage 0 - 100之间的一个整数
	 */
	public void onProgressUpdate(int percentage);
	
}
